package com.geticsen.leetcode;
//https://leetcode-cn.com/problems/latest-time-by-replacing-hidden-digits/submissions/
public class Solution_1736 {
    public String maximumTime(String time) {
        char[] chars = time.toCharArray();
        if (time.charAt(0) == '?') {
            chars[0] = time.charAt(1) >= '4' && time.charAt(1) <= '9' ? '1' : '2';
        }
        if (time.charAt(1) == '?') {
            chars[1] = time.charAt(0) == '2'||time.charAt(0) == '?' ? '3' : '9';
        }
        if (time.charAt(3) == '?') {
            chars[3] = '5';
        }
        if (time.charAt(4) == '?') {
            chars[4] = '9';
        }
        return String.valueOf(chars);
    }
}
